#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int hammingWeight(int n) {
        int num = 32, count = 0;
        while (num--)
        {
            if (n & 1 == 1)
                count++;
            n >>= 1;
        }
        return count;
    }
};